Data and Code for: Mr. Keynes meets the Classics: Government Spending and the Real Exchange Rate
by Benjamin Born, Frankfurt School (b.born@fs.de), Francesco D’Ascanio, Accenture (francescodascanio@yahoo.it), 
Gernot J. Müller, University of Tuebingen (gernot.mueller@uni-tuebingen.de), and Johannes Pfeifer, University of the Bundeswehr Munich (johannes.pfeifer@unibw.de)

Prepared: July 2023

The bullet points in the following refer to the respective folder names.

Quantitative Model

The quantitative model requires Matlab (the codes were tested with R2023a) with the optimization toolbox and a computer with at least 256GB RAM.

- Figure 2 Quantitative Model

1. Run BDMP_pfi_peg.m and BDMP_vfi_float.m to generate the policy rules of the model. 
2. Run compute_irfs_float.m, compute_irfs_full_employment.m, and compute_irfs_slack.m to generate the theoratical model IRFs.
3. Run plot_irfs_paper.m to generate the results of "Figure 2: Quantitative model irf"
4. Run generate_moments_table.m to produce "Table B.2 First and second moments in the two exchange-rate regimes" and 
   "Figure B.1: Quantitative model – ergodic debt distribution"

- Figure B.2 Monte Carlo irf – full employment

1. Run BDMP_pfi_peg_G_rule.m to generate the policy rules of the model. 
2. Run compute_irfs_MC_comparison.m to generate the theoratical model IRFs.
3. Run Monte_Carlo_exercise.m to generate Figure B.2: Monte Carlo irf – full employment as well as the middle panel of Figure 6: Exchange rate response in symmetric specifications.


Empirical IRFs:

All figures rely on Matlab and were tested with R2023a, with the exception of Figure 4, which was created with Stata. The Matlab based figures require first 
running the first stage sign restriction VARs. For this purpose, run Get_shocks_Sign_restrictions.m in both the folders "Sign_restriction_first_stage_shocks" and 
"Sign_restriction_first_stage_shocks_euro_area".  

- Figure 3+6 + Appendix C Descriptives

1. Run Figure_3 to generate Figure 3. Note that the negotiated wage figure relies on the proprietary index of negotiated wages (base 1995=100 and base 2005=100) 
    from Statistics Finland
2. Run Figure_6 to generate Figure 6.
3. Based on these two runs, execute Table_C3_sample_ranges.m to create Table C.3: Sample ranges 
4. Run Table_C4.m to generate Table C.4: Pairwise correlations between government spending shocks within the EA sample 
5. Run Figure_C1.m to generate Figure C.1: Sign-restriction vs. Blanchard-Perotti government spending shocks

- Figure 5 Military spending

1. Run Figure_5_run_military_spending_LP.do in Stata with parmest and outreg2 installed. The figure in the paper was generated with Stata 17. 

- Figure 7 EA symmetric

1. Run Figure_7_EA_symmetric.m to generate the top panel (EA) of Figure 7: Exchange rate response in symmetric specifications. 
   Requires Figure 3 to have previously been generated.

- Figure 7 US Fiscal VAR

1. Run Figure_7_step_1_symmetric_VAR.m to generate the symmetric VAR IRFs.
2. Run Figure_7_step_2_asymmetric_LP.m to generate the results of the bottom panel of Figure 7.

- Figure 8: Balanced budget government spending shock

1. Run Figure_8_LP_balanced_budget_shock.m to create Figure 8: Balanced budget government spending shock

- Figure D.1 BP Identification

1. Run Figure_D1.m to create Figure D.1: Adjustment to government spending shocks – Blanchard and Perotti (2002) identification

- Figure D.2 Exclude Big Countries
1. Run Figure_D2.m to create Figure D.2: IRFs – ea excluding big countries

- Figure D.3 Exclude Greece

1. Run Figure_D3.m to create Figure D.3: IRFs – EA excluding Greece

- Figure D.4 Broad FX
1. Run Figure_D4.m to create Figure D.4: IRFs – EA with broad real effective exchange rate

- Figure D.5 Slack + Inflation
1. Run Figure_D5.m to create Figure D.5: IRFs – Inflation and slack v baseline. Requires Figures 3 to have previously been generated.

- Figure D.6 Alternative Slack
1. Run Figure_D6.m to create Figure D.6: IRFs – Slack v baseline (for alternative slack measures). Requires Figures 3 to have previously been generated.

- Table 1 Differences in response coefficients across states and shock signs
1. Run Table_1.m to create the last four lines of Table 1: Differences in response coefficients across states and shock signs. The first line is displayed
   when creating Figure 3.